<html>
  <head>
  <script type="text/javascript" src="<?php echo SKIN_URL_JS; ?>/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'total member views'],
		  <?php foreach($chart as $row) {?>
          ['<?php echo $row['year']; ?>',  <?php echo $row['total']; ?>],
		 	<?php  } ?>
        ]);

        var options = {
          title: 'Member view',
          hAxis: {title: 'Year',  titleTextStyle: {color: '#333'}},
          vAxis: {minValue: 0}
        };

        var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 500px; height: 200px;"></div>
    <a href="javascript:void()" onClick="return_data('access','total_access')">total access</a><span class="" id="total_access"> </span><br>
    <a href="javascript:void()" onClick="return_data('shared','total_shared')">total shared</a><span class="" id="total_shared"> </span><br>
    <a href="javascript:void()" onClick="return_data('like','total_like')">total like</a><span class="" id="total_like"></span> <br>
    <a href="javascript:void()" onClick="return_data('download','total_download')">total download</a><span class="" id="total_download"> </span><br>
    <a href="javascript:void()" onClick="return_data('dislike','total_dislike')">total dislike</a><span class="" id="total_dislike"> </span><br>
    <a href="javascript:void()" onClick="return_data('correct','total_correct_answer')">total correct answer </a><span class="" id="total_correct_answer"> </span><br>
    <a href="javascript:void()" onClick="return_data('incorrect','total_incorrect_answer')">total incorrect answer</a><span class="" id="total_incorrect_answer"> </span>
     <script type="text/javascript">
		function return_data(value,id){
		//alert(value);
		$.ajax({
			
			type:"POST",
			url:'<?php echo base_url().BASE; ?>study/question_analytics',
			data:{'value':value},
			cache: false,
			success:function(te){
				alert(te);
				$("#"+id).html(te);
			},
			 error:function(te){
			 alert('fail');
				 }
				});
			}
	</script>
  </body>
</html>

<?php  
?>